home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_ctrllever5.cog < prev    next >
Text File  |  1999-11-15  |  11KB  |  411 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_CtrlLever5.cog
  4. #
  5. # Sets up lever5 in the "pushed" possition (ready for pull) at level start.
  6. #
  7. # [TRM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     
  14.     message     startup
  15.     message     user0
  16.     message     user1
  17.     message     activated
  18.    
  19.     thing       player          local
  20.     thing       leverGhost      # Lever position
  21.     thing       indy            # Actor Indy
  22.     thing       trkSwitch       # Track switch
  23.     thing       panelTarget     # focus for control panel
  24.     
  25.     thing       switchCam       # Switch cam
  26.     thing       ctrlCam1        # Control panel cam
  27.  
  28.     thing       pushed          local
  29.     thing       pulled          local
  30.     
  31.     thing       offsetCam
  32.     
  33.     surface     switch1
  34.     surface     switch4
  35.     surface     switch5
  36.     
  37.     # Track faces -- A default -- B secondary
  38.     surface     switchA    
  39.     surface     switchB      
  40.     
  41.     template    tplLevPull=pullever          local
  42.     template    tplLevPush=pushlever         local
  43.     
  44.     keyframe    leverPull=gen_lever_pull.key        local
  45.     keyframe    leverPush=gen_lever_push.key        local
  46.     
  47.     keyframe    indyPull=in_pull_lever.key          local
  48.     keyframe    indyPush=in_push_lever.key          local
  49.     
  50.     cog         comFalls
  51.     cog         hintCog
  52.     
  53.     sound       sndLever=gen_lever_pull.wav             local
  54.     sound       sndSwitchTex=sol_panel_switch_c.wav     local
  55.     sound       inJuice=Sl02j04.wav                     local
  56.     
  57.     int         powerOn=0       local
  58.     int         ready=1         local
  59.     int         playing=0       local
  60.     int         done=0          local
  61.     int         curCam          local
  62.     int         sound2          local
  63.     
  64.     # ** subroutines **
  65.     flex        pullLever       local
  66.     flex        pushLever       local
  67.     flex        resetcam        local
  68.     flex        noPower         local
  69.     
  70. end
  71.  
  72. # ========================================================================================
  73.  
  74. code
  75.  
  76. startup:
  77.  
  78.     pushed = CreateThing(tplLevPull, leverGhost);
  79.     CaptureThing(pushed);
  80.     
  81.     # Mine car track -- Turn off
  82.     ClearSurfaceFlags(switchA, 0x4000);
  83.     SetSurfaceFlags(switchB, 0x4000);
  84.     Sleep(0.5);
  85.     
  86.     return;
  87.  
  88. # ========================================================================================
  89.  
  90. user0:
  91.  
  92.     powerOn = 1;
  93.     return;
  94.  
  95. # ========================================================================================
  96.  
  97. user1:
  98.  
  99.     # comFalls says to destroy this
  100.     DestroyThing(pushed);
  101.     
  102.     # Mine car track -- Go straight
  103.     ClearSurfaceFlags(switchB, 0x4000);
  104.     SetSurfaceFlags(switchA, 0x4000);
  105.     return;
  106.  
  107. # ========================================================================================
  108.  
  109. activated:
  110.  
  111.     Print("activated: ctrlLever5");
  112.  
  113.     player = GetLocalPlayerThing();
  114.     curCam = GetCurrentCamera();
  115.     
  116.     # SOL_ComFalls is handling this lever now
  117.     if(done == 1) return;
  118.     
  119.     # no power
  120.     if((GetSenderRef() == pushed) && (IsGhostVisible(player, pushed, 50.0)) && (!powerOn) && (!playing) && (!done))
  121.     {
  122.         playing = 1;
  123.         Call noPower;
  124.     }
  125.  
  126.     # pull lever
  127.     else if((GetSenderRef() == pushed) && (IsGhostVisible(player, pushed, 50.0)) && (powerOn) && (ready) && (!done))
  128.     {
  129.         ready = 0;
  130.         Call pullLever;
  131.     }
  132.         
  133.     # push lever
  134.     else if((GetSenderRef() == pulled) && (IsGhostVisible(player, pulled, 50.0)) && (powerOn) && (ready) && (!done))
  135.     {
  136.         ready = 0;
  137.         Call pushLever;
  138.     }
  139.  
  140.     return;
  141.         
  142. # ========================================================================================
  143.  
  144. noPower:
  145.  
  146.     # do cutscene stuff
  147.     MakeMeStop();
  148.     StartCutscene(2);
  149.     
  150.     # switch to offsetCam
  151.     SetCameraFocus(2, offsetCam);
  152.     SetCameraSecondaryFocus(2, player);
  153.     SetCurrentCamera(2);
  154.     SetCameraFOV(90, 0, 0.0);
  155.     
  156.     # put away any weapon
  157.     DeselectWeaponWait(player);
  158.     
  159.     # activate lever
  160.     PlayMode(player, 60, 0);
  161.     Sleep(0.3);
  162.     
  163.     # say line
  164.     PlayVoice(player, inJuice, 1.0, 1);
  165.     Sleep(0.5);
  166.     
  167.     # restore controls and camera
  168.     ClearActorFlags(player, 0x200000);
  169.     SetCurrentCamera(curCam);
  170.     
  171.     EndCutscene();
  172.     
  173.     playing = 0;
  174.     
  175.     return;
  176.  
  177. # ========================================================================================
  178.  
  179. pullLever:
  180.  
  181.     global2 = 0;
  182.     
  183.     # tell hintCog to check switch positions
  184.     SendMessage(hintCog, user1);
  185.     
  186.     # do cutscene stuff
  187.     MakeMeStop();
  188.     StartCutscene(2);
  189.     
  190.     # switch to offsetCam
  191.     SetCameraFocus(2, offsetCam);
  192.     SetCameraSecondaryFocus(2, player);
  193.     SetCurrentCamera(2);
  194.     SetCameraFOV(90, 0, 0.0);
  195.     
  196.     # put away any weapon
  197.     DeselectWeaponWait(player);
  198.     
  199.     # outfit Indy actor
  200.     CopyPlayerHolsters(player, indy);
  201.     
  202.     # show actor hide player
  203.     SetThingFlags(player, 0x80000);
  204.     ClearThingFlags(indy, 0x80000);
  205.     
  206.     # pull the lever
  207.     PlayKey(pushed, leverPull, 4, 0x14, 0);
  208.     PlayKey(indy, indyPull, 4, 0x12, 0);
  209.     Sleep(0.85);
  210.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  211.     
  212.     # Cut to Control Panel cam
  213.     SetCameraFocus(2, ctrlCam1);
  214.     SetCameraSecondaryFocus(2, panelTarget);
  215.     SetCurrentCamera(2);
  216.     SetCameraFOV(90, 0, 0.0);
  217.     Sleep(0.5);
  218.     
  219.     # flip panel switch
  220.     SetWallCel(switch5, 2);
  221.     sound2 = PlaySoundLocal(sndSwitchTex, 1.0, 0.0, 0x0, 0);
  222.     WaitForSound(sound2);
  223.     Sleep(0.5);
  224.     
  225.     # Cut to switch cam
  226.     SetCameraFocus(2, switchCam);
  227.     SetCameraSecondaryFocus(2, trkSwitch); 
  228.     SetCurrentCamera(2);
  229.     SetCameraFOV(90, 0, 0.0);
  230.     
  231.     # rotate track switch
  232.     Rotate(trkSwitch, 90, 1, 1.0);
  233.     Sleep(2.0);
  234.     
  235.     # restore camera and controls
  236.     Call resetcam;
  237.     
  238.     # Destroy old lever and create a new one
  239.     DestroyThing(pushed);
  240.     pulled = CreateThing(tplLevPush, leverGhost);
  241.     CaptureThing(pulled);
  242.     
  243.     # Mine car track -- Go straight
  244.     ClearSurfaceFlags(switchB, 0x4000);
  245.     SetSurfaceFlags(switchA, 0x4000);
  246.     
  247.     ready = 1;
  248.         
  249.     return;
  250.     
  251. # ========================================================================================
  252.  
  253. pushLever:
  254.  
  255.     global0 = 0;
  256.     global1 = 0;
  257.     global2 = 1;
  258.     
  259.     # tell hintCog to check switch positions
  260.     SendMessage(hintCog, user1);
  261.     
  262.     # do cutscene stuff
  263.     MakeMeStop();
  264.     StartCutscene(2);
  265.     
  266.     # switch to offsetCam
  267.     SetCameraFocus(2, offsetCam);
  268.     SetCameraSecondaryFocus(2, player);
  269.     SetCurrentCamera(2);
  270.     SetCameraFOV(90, 0, 0.0);
  271.     
  272.     # put away any weapon
  273.     DeselectWeaponWait(player);
  274.     
  275.     # outfit Indy actor
  276.     CopyPlayerHolsters(player, indy);
  277.     
  278.     # show actor hide player
  279.     SetThingFlags(player, 0x80000);
  280.     ClearThingFlags(indy, 0x80000);
  281.     
  282.     # push the lever
  283.     PlayKey(pulled, leverPush, 4, 0x14, 0);
  284.     PlayKey(indy, indyPush, 4, 0x12, 0);
  285.     Sleep(0.75);
  286.     PlaySoundLocal(sndLever, 1.0, 0.0, 0x0, 1);
  287.     
  288.     # Cut to Control Panel cam
  289.     SetCameraFocus(2, ctrlCam1);
  290.     SetCameraSecondaryFocus(2, panelTarget);
  291.     SetCurrentCamera(2);
  292.     SetCameraFOV(90, 0, 0.0);
  293.     Sleep(0.5);
  294.     
  295.     # flip panel switch
  296.     SetWallCel(switch5, 1);
  297.     sound2 = PlaySoundLocal(sndSwitchTex, 1.0, 0.0, 0x0, 0);
  298.     WaitForSound(sound2);
  299.     Sleep(0.5);
  300.     
  301.     # Cut to switch cam
  302.     SetCameraFocus(2, switchCam);
  303.     SetCameraSecondaryFocus(2, trkSwitch);
  304.     SetCurrentCamera(2);
  305.     SetCameraFOV(90, 0, 0.0);
  306.     
  307.     # rotate track switch
  308.     Rotate(trkSwitch, -90, 1, 1.0);
  309.     Sleep(2.0);
  310.     
  311.     # go about business as usual
  312.     if(global3 == 1)
  313.     {
  314.         # just restore camera and controls
  315.         call resetcam;
  316.     }
  317.         
  318.     # deal with comCar issues
  319.     else if(global3 == 0)
  320.     {
  321.         # switches 1 and 5 are ready, switch 4 is not: do nothing
  322.         if((GetWallCel(switch1) == 2) && (GetWallCel(switch4) == 1) && (GetWallCel(switch5) == 1))
  323.         {
  324.             #Print("CtrlLever5 -- 1 and 5 ready, 4 not ready");
  325.             
  326.             # just restore camera and controls
  327.             call resetcam;
  328.         }
  329.             
  330.         # switch 1 not ready: do nothing
  331.         if(GetWallCel(switch1) == 1)
  332.         {
  333.             #Print("CtrlLever5 -- Switch 1 not ready");
  334.             
  335.             # just restore camera and controls
  336.             call resetcam;
  337.         }
  338.             
  339.         # switches 1 and 4 ready, 5 not ready: do partial
  340.         if((GetWallCel(switch1) == 2) && (GetWallCel(switch4) == 2) && (GetWallCel(switch5) == 2))
  341.         {
  342.             #Print("CtrlLever5 -- 1 and 4 ready, 5 isn't");
  343.             
  344.             # hide indy show player
  345.             SetThingFlags(indy, 0x80000);
  346.             ClearThingFlags(player, 0x80000);
  347.             
  348.             # watch comCar enter switch4 from frontShot
  349.             SendMessage(comFalls, user1);
  350.             
  351.             # tell comFalls to do partial
  352.             SendMessage(comFalls, user0);
  353.         }
  354.             
  355.         # switches 1, 4 and 5 are ready: send commies over edge
  356.         if((GetWallCel(switch1) == 2) && (GetWallCel(switch4) == 2) && (GetWallCel(switch5) == 1))
  357.         {
  358.             #Print("CtrlLever5 -- send commies over edge");
  359.             
  360.             # hide indy show player
  361.             SetThingFlags(indy, 0x80000);
  362.             ClearThingFlags(player, 0x80000);
  363.             
  364.             # tell comFalls we're go
  365.             SendMessage(comFalls, user0);
  366.             
  367.             # watch comCar enter switch4 from frontShot
  368.             SendMessage(comFalls, user1);
  369.             
  370.             # next time we skip all of this 'cus comCar is dead
  371.             global3 = 1;
  372.         }
  373.     }
  374.     
  375.     # Destroy old lever and create a new one
  376.     DestroyThing(pulled);
  377.     pushed = CreateThing(tplLevPull, leverGhost);
  378.     CaptureThing(pushed);
  379.     
  380.     # Mine car track -- turn off
  381.     SetSurfaceFlags(switchB, 0x4000);
  382.     ClearSurfaceFlags(switchA, 0x4000);
  383.     
  384.     ready = 1;
  385.         
  386.     return;
  387.  
  388. # ========================================================================================
  389.  
  390. resetcam:
  391.  
  392.     #Print("lever5 -- resetcam");
  393.     
  394.     # hide indy show player
  395.     SetThingFlags(indy, 0x80000);
  396.     ClearThingFlags(player, 0x80000);
  397.     
  398.     # restore camera
  399.     SetCurrentCamera(curCam);
  400.     
  401.     # restore controls
  402.     ClearActorFlags(player, 0x200000);
  403.     EndCutscene();
  404.             
  405.     return;
  406.  
  407. # ========================================================================================
  408.  
  409. end
  410.  
  411.